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