UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jvA16WpzUMlgxQiyVsIjtTnsCBlBcBuyQeaa7nVuDmA=' 
WHERE 
  key_id = '1896f1d1222f0f4a0adc95f51571a1db99f568321ed4ab250c579c812445a417' 
  AND (
    token = 'jvA16WpzUMlgxQiyVsIjtTnsCBlBcBuyQeaa7nVuDmA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042