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