UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a7n2Hhi02hUjKQrzegjRqHQkUxKaEqONkx15AWyM9x4='
WHERE
key_id = '7f3bf1f7b8d8c59cbb013120a07df90513bb016243e4e65207bc4f9a85ea9e4c'
AND (
token = 'a7n2Hhi02hUjKQrzegjRqHQkUxKaEqONkx15AWyM9x4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)