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

Query time 0.00023