UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IgD3KpUSYdPzdiYvNQGdyOyYJNXYj1jNyj0n+/8VY2k=' 
WHERE 
  key_id = '385e8639bcaccd6413b9aa35036b5d45cea2cac8b1f468eaccf72e44ea3934ef' 
  AND (
    token = 'IgD3KpUSYdPzdiYvNQGdyOyYJNXYj1jNyj0n+/8VY2k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045