UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sUlsPSCjPURwukjHuT1RdsfkZ7YveIs/w019sX00nVo=' 
WHERE 
  key_id = 'a3ba18f96be6caea158bd39e613708834f8976427eee7225c7869febadbb2a8e' 
  AND (
    token = 'sUlsPSCjPURwukjHuT1RdsfkZ7YveIs/w019sX00nVo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053