UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XuWYIw0eEq9Xwru3EOwfye+y3My5KxfCInISOqo97j4=' 
WHERE 
  key_id = '672611d8c706565db9051d04e62fcd81a74464d3229a722c5c41b5891ebb5cf0' 
  AND (
    token = 'XuWYIw0eEq9Xwru3EOwfye+y3My5KxfCInISOqo97j4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032