UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZY9o4eXEwJ8sk1SXUuCVjFJl7BHQsQlWrH/QBBTScvk='
WHERE
key_id = 'd93836b807d002e6d42eb778695f84f9269032d4d419a70e34f36a7c546ec6bd'
AND (
token = 'ZY9o4eXEwJ8sk1SXUuCVjFJl7BHQsQlWrH/QBBTScvk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)