UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5nphswBr1qnRJF72Pl0qOPVQ1RK7B97OvvL2OGrnIHU=' 
WHERE 
  key_id = 'd580fc5cdc487078cd37502a08464fcfa251c1f40687ecd9c1f18da08f990705' 
  AND (
    token = '5nphswBr1qnRJF72Pl0qOPVQ1RK7B97OvvL2OGrnIHU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027