UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U/AVYsOg6EP7P7+Uqtbxe7DwI3UXmI5QnqkM76RTlW4=' 
WHERE 
  key_id = '22d980c2c89d4398a78bb457c576f5de0b5ed8727d28dcc5da1626ed83f65996' 
  AND (
    token = 'U/AVYsOg6EP7P7+Uqtbxe7DwI3UXmI5QnqkM76RTlW4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033