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