UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TeA6CThEDr17v1E9z1X2H/BpPn8IdlC9DvD9B5J7Od0='
WHERE
key_id = '04ea5922eeb2d0063deb1a89d1fda05cda0959de542705d2db0b6ef5116ed3d3'
AND (
token = 'TeA6CThEDr17v1E9z1X2H/BpPn8IdlC9DvD9B5J7Od0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)