UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GZxrir8kyBoOv9yXqnCJYFXTwZGaRVMcIkZwPnqDgJw=' 
WHERE 
  key_id = 'f11821349f6fcd382858b99bead476e51be4e81b692da398357e875917c69b1a' 
  AND (
    token = 'GZxrir8kyBoOv9yXqnCJYFXTwZGaRVMcIkZwPnqDgJw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058