UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tfPhN9Y4JIjqThgm0+WrEUF3OVkrGQxsRQ70otHpF+w=' 
WHERE 
  key_id = '1a86c81c6ec89cc5d7c0cb3fdd52544b8d0a1589bcb65bd0936c71e78f8aab17' 
  AND (
    token = 'tfPhN9Y4JIjqThgm0+WrEUF3OVkrGQxsRQ70otHpF+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037