UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'U6p3SYYs6D2aZ/woo3drR+17RB0Hl5t198HiD2jTLZ0='
WHERE
key_id = '2ecd50e88e5edeba3629a688c723f8d475619df0ec65dab9b538ea8b166ca510'
AND (
token = 'U6p3SYYs6D2aZ/woo3drR+17RB0Hl5t198HiD2jTLZ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)