UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6K91/66VWTp0M5wM6RsS6SmtFaqXgiWe9S0vYAicO2U=' 
WHERE 
  key_id = '3e35d413f9eb04e48c84d8489de14c05495b2204b82b64cbb1311505807dcc16' 
  AND (
    token = '6K91/66VWTp0M5wM6RsS6SmtFaqXgiWe9S0vYAicO2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044