UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O0SSQgD3amXTd0JBB3DK83ZMGcvYJhusNCqTdfkNUJY='
WHERE
key_id = '2219f355ff1afd72f0b9299960d1c8c4cf60b1041b1850cde964a737f79633dc'
AND (
token = 'O0SSQgD3amXTd0JBB3DK83ZMGcvYJhusNCqTdfkNUJY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)