UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HM2g/ZTZHzNCk6RRfvTAEv7YZzdwk4AKV9PSrZpbbZY=' 
WHERE 
  key_id = '07ae3b13671ea311be811e17248da60e72515ff61a5903a671b9637329832570' 
  AND (
    token = 'HM2g/ZTZHzNCk6RRfvTAEv7YZzdwk4AKV9PSrZpbbZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047