UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b9gJ+NNzZ0gboE68PhV6NInXjGUqoHn1v+3J3RlBRCg=' 
WHERE 
  key_id = '09761b00977f4591ca3eb973627b0ff307841c763a9af5b9f8743da3f0702726' 
  AND (
    token = 'b9gJ+NNzZ0gboE68PhV6NInXjGUqoHn1v+3J3RlBRCg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014