UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l2C/P1LO2C34hKPOiFxl2F+tOcrSn2To3rdA0Jg8t4s='
WHERE
key_id = 'caaec2bef8ce2d4161cf5d4f299112466892da99f1df9f65e577b7d025fb03be'
AND (
token = 'l2C/P1LO2C34hKPOiFxl2F+tOcrSn2To3rdA0Jg8t4s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)