UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JJz6zK9IseD9d+laIO/6ffeJBprWv5SxIPtTVVxJVrw='
WHERE
key_id = 'ac9a7487088f8f8248416d081ffff438efa4dde50c170e2e4200817a57282ac9'
AND (
token = 'JJz6zK9IseD9d+laIO/6ffeJBprWv5SxIPtTVVxJVrw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)