UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KUALked9qlJklQqOybVddUlXhSnrYeIYyF2sYvMqKrM=' 
WHERE 
  key_id = '6290a8626d53b98ee2aa5a2f2d70bf3ba70f17107bb5da94697026504307d9f0' 
  AND (
    token = 'KUALked9qlJklQqOybVddUlXhSnrYeIYyF2sYvMqKrM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019