UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'btdDZmVJXpuOHwKCbL5hVfvhx96tHwHkoad5QSrtC/Y=' 
WHERE 
  key_id = '3d01a5ef9e43d733d463f4c1046155994641feb4a1163a0331ff2618378be9de' 
  AND (
    token = 'btdDZmVJXpuOHwKCbL5hVfvhx96tHwHkoad5QSrtC/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026