UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 's2m462IF7ZnCtZUGTAfTcMqmCEmN5ooIaNtxfpfQxzg='
WHERE
key_id = '39bebfaeb249e9928327d23ac95d998724847af0946bbce561691fdd2b157f6e'
AND (
token = 's2m462IF7ZnCtZUGTAfTcMqmCEmN5ooIaNtxfpfQxzg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)