UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gyu1n+Dw9N3eYfP3M0ue/LIPQFVgJs4M1KKxBV/n6+A=' 
WHERE 
  key_id = '334d040a3ed75d88b91940737faef237dd2857421d774d46139bf50c3ad17c57' 
  AND (
    token = 'Gyu1n+Dw9N3eYfP3M0ue/LIPQFVgJs4M1KKxBV/n6+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048