UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E0sk8t0aV9dx3rIADhooHEfieB0eqJuC2gYtrWskWYw='
WHERE
key_id = '56043191c695edc9a5c36b185928f873dd7a9e7f7fb1fa84101a397aff9d9dbd'
AND (
token = 'E0sk8t0aV9dx3rIADhooHEfieB0eqJuC2gYtrWskWYw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)