UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gdjHeCelfeK+zQIAqzWzj2czyLUc2697mmDQnNyggZY=' 
WHERE 
  key_id = '269f939ee38af4fbdd5da9766ba88cd602da68104223b41946286328c3427fe2' 
  AND (
    token = 'gdjHeCelfeK+zQIAqzWzj2czyLUc2697mmDQnNyggZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038