UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd3z+bhQGNRxvzI9WMmSWMidrDIQIVhpGtnZiypiKOxQ=' 
WHERE 
  key_id = 'f9ea024d6bba88c40952971733ea8b5713deaa02c5772fe3838302159a77d017' 
  AND (
    token = 'd3z+bhQGNRxvzI9WMmSWMidrDIQIVhpGtnZiypiKOxQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035