UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S0xWg5aGnCXIUYZKLhHUhBNBPKxXqPLkWWZWJAXM9t8='
WHERE
key_id = '47e83fea4373ab904d968f5808a2b6bffb5e88249d691d7eea8c1a368fe7590e'
AND (
token = 'S0xWg5aGnCXIUYZKLhHUhBNBPKxXqPLkWWZWJAXM9t8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)