UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g6C5VUuTV94J6i0NX3bdAE984zyrEcGDYTGQKQIIUaI='
WHERE
key_id = '9b6043e22e1c94b0db7defa5bce03cff11d1bbda44f601e8c486b77d64ab8e3a'
AND (
token = 'g6C5VUuTV94J6i0NX3bdAE984zyrEcGDYTGQKQIIUaI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)