UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'atQas0bqVuE3L4RRSVIBb6rCPaLTDcs9RW0RsIirUTc='
WHERE
key_id = 'e570737817e9afda00042054c7f3e00b8e0e79bc7848b5e6287137efc395d436'
AND (
token = 'atQas0bqVuE3L4RRSVIBb6rCPaLTDcs9RW0RsIirUTc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)