UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mV7kp5ucMinqzUd/xcPwlAhOuoEiUIvX5ebhZwewO8k='
WHERE
key_id = '582e16ce4a90140792bef6f6e3cf86939576a148a2406e3f96366b0189138545'
AND (
token = 'mV7kp5ucMinqzUd/xcPwlAhOuoEiUIvX5ebhZwewO8k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)