UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hhq0DukuuIyrH4Sd316UD36PZ5GX0ffFyGtXDEt/sMo=' 
WHERE 
  key_id = '88b2f1331d1c80eebfb4263f9f80d5723304686e6605063494cac56d3a5a449a' 
  AND (
    token = 'hhq0DukuuIyrH4Sd316UD36PZ5GX0ffFyGtXDEt/sMo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037